<!--#Include File="../conn.asp" -->
<!--#Include File="comm/inc.asp" -->
<!--#Include File="../include/cls_editor.asp" -->
<%
'====================================================================
'= Team Elite - Elite Article System
'= Copyright (c) 2005 - 2006 Eason Chan All Rights Reserved.
'=-------------------------------------------------------------------
'= 版权协议：
'=	GPL (The GNU GENERAL PUBLIC LICENSE Version 2, June 1991)
'=-------------------------------------------------------------------
'= 文件名称：/Manager/Admin_Content.asp
'= 摘    要：后台-文章管理文件
'=-------------------------------------------------------------------
'= 最后更新：eason007
'= 最后日期：2006-04-21
'====================================================================

Call EA_Manager.Chk_IsMaster

If Not EA_Manager.Chk_Power(Admin_Power,"12") Then 
	ErrMsg=str_Comm_NotAccess
	Call EA_Manager.Error(1)
End If

Dim Atcion
Atcion=Request.QueryString ("atcion")

Select Case LCase(Atcion)
Case "add"
	Call Add
Case "save"
	Call Save
Case "del"
	Call Del
Case "batch"
	Call Batch
Case Else
	Call Main
End Select
Call EA_Pub.Close_Obj
Set EA_Pub=Nothing

Sub Main
	Dim Count,Page,OutStr,i,Level
	Dim FieldName(3),FieldValue(3)
	Dim WStr,TopicList,ColumnId,KeyWord,Field
	Dim Temp,ColumnList,ListBlock
	
	Page=EA_Pub.SafeRequest(3,"page",0,1,0)
	WStr=EA_Pub.SafeRequest(1,"w",1,"",0)
	ColumnId=EA_Pub.SafeRequest(1,"column",0,0,0)
	KeyWord=EA_Pub.SafeRequest(1,"title",1,"",0)
	Field=EA_Pub.SafeRequest(1,"field",0,-1,0)

	FieldName(0)="w"
	FieldName(1)="column"
	FieldName(2)="title"
	FieldName(3)="field"

	FieldValue(0)=WStr
	FieldValue(1)=ColumnId
	FieldValue(2)=KeyWord
	FieldValue(3)=Field

	PageContent=Template.LoadTemplate("admin_content_list.htm")
	
	Select Case WStr
	Case "1d"
		If iDataBaseType=0 Then 
			WStr=" where datediff('d',adddate,Now())=0 and isdel=0 "
		Else
			WStr=" where datediff(d,adddate,GetDate())=0 and isdel=0 "
		End If
	Case "1w"
		If iDataBaseType=0 Then 
			WStr=" where datediff('ww',adddate,Now())=0 and isdel=0 "
		Else
			WStr=" where datediff(ww,adddate,GetDate())=0 and isdel=0 "
		End If
	Case "1m"
		If iDataBaseType=0 Then 
			WStr=" where datediff('m',adddate,Now())=0 and isdel=0 "
		Else
			WStr=" where datediff(m,adddate,GetDate())=0 and isdel=0 "
		End If
	Case "pass"
		WStr=" where ispass="&EA_DBO.TrueValue&" and isdel=0 "
	Case "npass"
		WStr=" where ispass=0 and isdel=0 "
	Case "search"
		WStr=" where isdel=0"
		If Len(KeyWord) > 0 Then
			Select Case Field
			Case 0
				If iDataBaseType=0 Then 
					WStr=WStr&" and InStr(1,title,'"&KeyWord&"')>0"
				Else
					WStr=WStr&" and CharIndex('"&KeyWord&"',title)>0"
				End If
				
				Template.SetVariable "Search_Title"," selected",PageContent
			Case 1
				If iDataBaseType=0 Then 
					WStr=WStr&" and InStr(1,keyword,'"&KeyWord&"')>0"
				Else
					WStr=WStr&" and CharIndex('"&KeyWord&"',keyword)>0"
				End If

				Template.SetVariable "Search_Keyword"," selected",PageContent
			Case 2
				If iDataBaseType=0 Then 
					WStr=WStr&" and InStr(1,author,'"&KeyWord&"')>0"
				Else
					WStr=WStr&" and CharIndex('"&KeyWord&"',author)>0"
				End If

				Template.SetVariable "Search_Author"," selected",PageContent
			End Select
		End If
		If ColumnId<>0 Then WStr=WStr&" and columnid="&ColumnId
	Case "reback"
		WStr=" where isdel="&EA_DBO.TrueValue
	Case Else
		WStr=" where isdel=0"
	End Select

	Temp=EA_DBO.Get_Column_List()
	If IsArray(Temp) Then
		For i=0 To UBound(Temp,2)
			Level		= (Len(Temp(2,i))/4-1)*3
			ColumnList  = ColumnList & "<option value=""" & Temp(0,i) & """"
			If ColumnId<>"" Then 
				If Cint(ColumnId)=Cint(Temp(0,i)) Then ColumnList = ColumnList & " selected"
			End If
			ColumnList	= ColumnList & ">"
			ColumnList	= ColumnList & "├"
			ColumnList	= ColumnList & String(Level,"-")
			ColumnList	= ColumnList & Temp(1,i) & "</option>"
		Next
	End If
	Template.SetVariable "ColumnList",ColumnList,PageContent


	Template.SetVariable "Language_Comm_Today",str_Comm_Today,PageContent
	Template.SetVariable "Language_Comm_Week",str_Comm_Week,PageContent
	Template.SetVariable "Language_Comm_Month",str_Comm_Month,PageContent
	Template.SetVariable "Language_Comm_State_NoPass",str_Comm_State_NoPass,PageContent
	Template.SetVariable "Language_Comm_State_Pass",str_Comm_State_Pass,PageContent
	Template.SetVariable "Language_Comm_RecycleBin",str_Comm_RecycleBin,PageContent
	Template.SetVariable "Language_Comm_Select",str_Comm_Select,PageContent
	Template.SetVariable "Language_Comm_Bar_Operation",str_Comm_Bar_Operation,PageContent
	Template.SetVariable "Language_Comm_Edit_Operation",str_Comm_Edit_Operation,PageContent
	Template.SetVariable "Language_Comm_Alert_Del_Operation",str_Comm_Alert_Del_Operation,PageContent
	Template.SetVariable "Language_Comm_Del_Operation",str_Comm_Del_Operation,PageContent
	Template.SetVariable "Language_Comm_ListEmpty",str_Comm_ListEmpty,PageContent
	Template.SetVariable "Language_Comm_SelectAll",str_Comm_SelectAll,PageContent
	Template.SetVariable "Language_Comm_Submit_Button",str_Comm_Submit_Button,PageContent
	Template.SetVariable "Language_SearchNow",str_SearchNow,PageContent

	Template.SetVariable "Language_OperationNotice",str_OperationNotice,PageContent
	Template.SetVariable "Language_QuickSearchArticle",str_QuickSearchArticle,PageContent

	Template.SetVariable "Language_Content_ArticleList",str_Content_ArticleList,PageContent
	Template.SetVariable "Language_Content_AddArticle",str_Content_AddArticle,PageContent
	Template.SetVariable "Language_Content_Help",str_Content_Help,PageContent
	Template.SetVariable "Language_Content_Title",str_Content_Title,PageContent
	Template.SetVariable "Language_Content_Keyword",str_Content_Keyword,PageContent
	Template.SetVariable "Language_Content_Author",str_Content_Author,PageContent
	Template.SetVariable "Language_Content_Column",str_Content_Column,PageContent
	Template.SetVariable "Language_Content_Date",str_Content_Date,PageContent
	Template.SetVariable "Language_Content_State",str_Content_State,PageContent
	Template.SetVariable "Language_Content_Review",str_Content_Review,PageContent
	Template.SetVariable "Language_Content_Option",str_Content_Option,PageContent
	Template.SetVariable "Language_Content_Resume",str_Content_Resume,PageContent
	Template.SetVariable "Language_Content_Make",str_Content_Make,PageContent
	Template.SetVariable "Language_Content_BatchMove",str_Content_BatchMove,PageContent

	Template.SetVariable "Search_KeyWord",KeyWord,PageContent


	ListBlock=Template.GetBlock("list",PageContent)

	SQL="Select Count(Id) From [NB_Content]"&WStr
	Count=Conn.Execute(SQL)(0)
	If Count>0 Then 
		Template.SetVariable "ListTempty","none",PageContent

		If Rs.State=1 Then Rs.Close
		SQL="Select Id,Title,ColumnName,AddDate,ViewNum,CommentNum,IsPass,ColumnId,TrueTime From [NB_Content] "&WStr&" Order By TrueTime Desc"
		Rs.Open SQL,Conn,1,1
		If Not rs.eof And Not rs.bof Then 
			Rs.AbsolutePosition=Rs.AbsolutePosition+((Abs(Page)-1)*20)
			TopicList=Rs.GetRows(20)
		End If
		Rs.Close
		Set Rs=Nothing

		For i=0 To Ubound(TopicList,2)
			Temp=ListBlock

			Template.SetVariable "ArticleID",TopicList(0,i),Temp
			Template.SetVariable "ArticleURL",EA_Pub.Cov_ArticlePath(TopicList(0,i),TopicList(3,i),TopicList(8,i),EA_Pub.SysInfo(18)),Temp
			'ok
			Template.SetVariable "ArticleTitle",TopicList(1,i),Temp
			Template.SetVariable "Article_ColumnID",TopicList(7,i),Temp
			Template.SetVariable "Article_ColumnName",TopicList(2,i),Temp
			Template.SetVariable "ArticlePostTime",FormatDateTime(TopicList(3,i),2),Temp
            If TopicList(6,i) Then
				Template.SetVariable "ArticleStatus","<b>√</b>",Temp
            Else
				Template.SetVariable "ArticleStatus","<font color=""red""><b>×</b></font>",Temp
            End If
            

			Template.SetBlock "list",Temp,PageContent
		Next

		Template.SetVariable "PageListNav",EA_Manager.PageList(20,Count,Page,FieldName,FieldValue),PageContent
	End If
	Template.CloseBlock "list",PageContent


	Template.BaseReplace PageContent
	Template.OutStr PageContent
End Sub

Sub Add
	Dim PostId
	Dim Text,ColumnId,CutArticle
	Dim Level,TStr,ArticleTemplate_Id
	Dim TempArray,i,Temp,ColumnList,SourceList,ATemplateList
	Dim EA_Editor
	
	PostId=EA_Pub.SafeRequest(3,"postid",0,0,0)
	ArticleTemplate_Id=EA_Pub.SafeRequest(3,"temp_id",0,0,0)

	PageContent=Template.LoadTemplate("admin_content_option.htm")


	Template.SetVariable "EditorType",EA_Pub.SysInfo(23),PageContent
	Template.SetVariable "isAutoRemote",EA_Pub.SysInfo(22),PageContent

	Template.SetVariable "Language_OperationNotice",str_OperationNotice,PageContent

	Template.SetVariable "Language_Comm_Select",str_Comm_Select,PageContent
	Template.SetVariable "Language_Comm_ListEmpty",str_Comm_ListEmpty,PageContent
	Template.SetVariable "Language_Comm_Yes",str_Comm_Yes,PageContent
	Template.SetVariable "Language_Comm_No",str_Comm_No,PageContent
	Template.SetVariable "Language_Comm_Save_Button",str_Comm_Save_Button,PageContent
	Template.SetVariable "Language_Comm_Reset_Button",str_Comm_Reset_Button,PageContent

	Template.SetVariable "Language_Content_Open_AdvancedFunction",str_Content_Open_AdvancedFunction,PageContent
	Template.SetVariable "Language_Content_Close_AdvancedFunction",str_Content_Close_AdvancedFunction,PageContent
	Template.SetVariable "Language_Content_Add_Help",str_Content_Add_Help,PageContent
	Template.SetVariable "Language_Content_AddArticle",str_Content_AddArticle,PageContent
	Template.SetVariable "Language_Content_Title",str_Content_Title,PageContent
	Template.SetVariable "Language_Content_Column",str_Content_Column,PageContent
	Template.SetVariable "Language_Content_TColor",str_Content_TColor,PageContent
	Template.SetVariable "Language_Content_Color_Red",str_Content_Color_Red,PageContent
	Template.SetVariable "Language_Content_Color_Green",str_Content_Color_Green,PageContent
	Template.SetVariable "Language_Content_Color_Blue",str_Content_Color_Blue,PageContent
	Template.SetVariable "Language_Content_Keyword",str_Content_Keyword,PageContent
	Template.SetVariable "Language_Content_Author",str_Content_Author,PageContent
	Template.SetVariable "Language_Content_Summary",str_Content_Summary,PageContent
	Template.SetVariable "Language_Content_SummaryFromText",str_Content_SummaryFromText,PageContent
	Template.SetVariable "Language_Content_Img",str_Content_Img,PageContent
	Template.SetVariable "Language_Content_ReviewImg",str_Content_ReviewImg,PageContent
	Template.SetVariable "Language_Content_Top",str_Content_Top,PageContent
	Template.SetVariable "Language_Content_OutURL",str_Content_OutURL,PageContent
	Template.SetVariable "Language_Content_CutArticle",str_Content_CutArticle,PageContent
	Template.SetVariable "Language_Content_CutArticle_Not",str_Content_CutArticle_Not,PageContent
	Template.SetVariable "Language_Content_CutArticle_Auto",str_Content_CutArticle_Auto,PageContent
	Template.SetVariable "Language_Content_CutArticle_Manual",str_Content_CutArticle_Manual,PageContent
	Template.SetVariable "Language_Content_Page",str_Content_Page,PageContent
	Template.SetVariable "Language_Content_Source",str_Content_Source,PageContent
	Template.SetVariable "Language_Content_ViewNum",str_Content_ViewNum,PageContent
	Template.SetVariable "Language_Content_Date",str_Content_Date,PageContent
	Template.SetVariable "Language_Content_PassNow",str_Content_PassNow,PageContent
	Template.SetVariable "Language_Content_Date",str_Content_Date,PageContent
	Template.SetVariable "Language_Content_SaveAs",str_Content_SaveAs,PageContent
	Template.SetVariable "Language_Content_Word",str_Content_Word,PageContent
	Template.SetVariable "Language_Content_ArticleTemplate",str_Content_ArticleTemplate,PageContent

	
	TempArray=EA_DBO.Get_Article_Info(PostId,0)
	If IsArray(TempArray) Then 
		Template.SetVariable "Language_Content_TColor_" & TempArray(17,0)," selected",PageContent

		Template.SetVariable "ArticleID",PostId,PageContent
		Template.SetVariable "Title",TempArray(3,0),PageContent
		Template.SetVariable "KeyWord",TempArray(12,0),PageContent
		Template.SetVariable "AuthorID",TempArray(7,0),PageContent
		Template.SetVariable "Summary",EA_Pub.Un_Full_HTMLFilter(TempArray(4,0)),PageContent
		Template.SetVariable "ImgPath",TempArray(18,0),PageContent
		Template.SetVariable "Top_" & Abs(TempArray(19,0))," checked",PageContent
		Template.SetVariable "OutUrl",TempArray(11,0),PageContent
		Template.SetVariable "Source",TempArray(15,0),PageContent
		Template.SetVariable "SourceUrl",TempArray(16,0),PageContent
		Template.SetVariable "ViewNum",TempArray(6,0),PageContent
		Template.SetVariable "AddDate",TempArray(13,0),PageContent
		Template.SetVariable "Author",TempArray(8,0),PageContent
		If TempArray(20,0) Then Template.SetVariable "IsPass"," checked",PageContent
		
		Text=TempArray(5,0)
		ColumnId=TempArray(0,0)
		CutArticle=Split(TempArray(14,0),"|")
	Else
		Template.SetVariable "SaveAs","none",PageContent
		Template.SetVariable "IsPass"," checked",PageContent
		Template.SetVariable "AddDate",Now(),PageContent
		Template.SetVariable "Author",EA_Pub.SysInfo(21),PageContent
		Template.SetVariable "AuthorID","0",PageContent
		Template.SetVariable "ViewNum","0",PageContent
	End If

	If ArticleTemplate_Id<>0 Then Text=EA_M_DBO.Get_ArticleTemp_Info(ArticleTemplate_Id)(1,0)

	If Not IsArray(CutArticle) Then 
		ReDim CutArticle(1)
		CutArticle(0)=EA_Pub.SysInfo(5)
		CutArticle(1)=EA_Pub.SysInfo(6)
	End If
	Template.SetVariable "CutArticle_0_" & CutArticle(0)," selected",PageContent
	Template.SetVariable "CutArticle_1",CutArticle(1),PageContent

	Temp=EA_DBO.Get_Column_List()
	If IsArray(Temp) Then
		For i=0 To UBound(Temp,2)
			If InStr(1,","&Column_Power&",",","&Temp(0,i)&"1,") > 0 Or InStr(1,","&Column_Power&",",","&Temp(0,i)&"2,") > 0 Or InStr(1,","&Column_Power&",",","&Temp(0,i)&"3,") > 0 Then
				Level		= (Len(Temp(2,i))/4-1)*3
				ColumnList	= ColumnList & "<option value=""" & Temp(0,i) & "|||" & Temp(1,i) & "|||" & Temp(2,i) & """"
				If ColumnId<>"" Then 
					If Cint(ColumnId)=Cint(Temp(0,i)) Then ColumnList = ColumnList & " selected"
				End If
				
				ColumnList	= ColumnList & ">"
				ColumnList	= ColumnList & "├"
				ColumnList	= ColumnList & String(Level,"-")
				ColumnList	= ColumnList & Temp(1,i) & "("
				
				If InStr(1,","&Column_Power&",",","&Temp(0,i)&"1,")>0 Then ColumnList	= ColumnList & str_Master_Column_Add & " "
				If InStr(1,","&Column_Power&",",","&Temp(0,i)&"2,")>0 Then ColumnList	= ColumnList & str_Master_Column_Manager & " "
				If InStr(1,","&Column_Power&",",","&Temp(0,i)&"3,")>0 Then ColumnList	= ColumnList & str_Master_Column_Edit & " "
					
				ColumnList	= ColumnList & ")</option>"
			End If
		Next
	End If
	Template.SetVariable "ColumnList",ColumnList,PageContent

	Temp=EA_M_DBO.Get_ArticleTemp_List(1,50)
	If IsArray(Temp) Then
		For i=0 To UBound(Temp,2)
			ATemplateList = ATemplateList & "<option value=""" & Temp(0,i) & """>"
			ATemplateList = ATemplateList & Temp(1,i)&"</option>"
		Next
	End If
	Template.SetVariable "ArticleTemplateList",ATemplateList,PageContent

	Temp=EA_DBO.Get_System_Info()
	If IsArray(Temp) Then
		If Not IsNull(Temp(6,0)) Then 
			TempArray=Split(Temp(6,0),";")

			For i=0 To UBound(TempArray)
				TStr=""
				TStr=Split(TempArray(i),"==")

				SourceList = SourceList & "<option value='"&TempArray(i)&"'>"&TStr(0)&"</option>"
			Next
		End If
	End If
	Template.SetVariable "SourceList",SourceList,PageContent

	Set EA_Editor=New cls_Editor
	EA_Editor.EditorType=EA_Pub.SysInfo(23)
	EA_Editor.Value=Text
	Template.SetVariable "Editor",EA_Editor.Create,PageContent
	'Template.SetVariable "Editor","<textarea name='content' cols='80' rows='10'></textarea>",PageContent

	Template.BaseReplace PageContent
	Template.OutStr PageContent

	Set Rs=Nothing
End Sub

Sub Save
	Call EA_Pub.Chk_Post
	
	Dim Title,Author,Text,KeyWord,ColumnId,ColumnName,ColumnCode,Byter,TColor,IsImg,ImgPath,IsTop,IsDis,OutUrl,IsOut,AuthorId,CutArticle,ViewNum,AddDate,IsPass,Source,SourceUrl,Summary
	Dim PostId,TempStr,TrueTime,IsSaveAs
	Dim Key,i
	
	If Request.Form("column")="" Or Request.Form("column")="0" Then 
		ErrMsg=str_PassDataError
		Call EA_Manager.Error(1)
	End If
	
	FoundErr=False
	
	PostId=EA_Pub.SafeRequest(3,"postid",0,0,0)
	Title=EA_Pub.SafeRequest(2,"title",1,"",1)
	Author=EA_Pub.SafeRequest(2,"author",1,"",1)

	For i = 1 To Request.Form("content").Count
	  Text = Text & Request.Form("content")(i)
	Next

	KeyWord=EA_Pub.SafeRequest(2,"keyword",1,"",1)
	TempStr=Split(Request.Form ("Column"),"|||")
	ColumnId=EA_Pub.SafeRequest(0,Trim(TempStr(0)),0,0,0)
	ColumnName=EA_Pub.SafeRequest(0,Trim(TempStr(1)),1,"",1)
	ColumnCode=EA_Pub.SafeRequest(0,Trim(TempStr(2)),1,"",0)
	TColor=EA_Pub.SafeRequest(2,"color",0,0,0)
	ImgPath=EA_Pub.SafeRequest(2,"img",1,"",1)
	IsTop=EA_Pub.SafeRequest(2,"istop",0,0,0)
	OutUrl=EA_Pub.SafeRequest(2,"outurl",1,"",1)
	AuthorId=EA_Pub.SafeRequest(2,"authorid",0,0,0)
	CutArticle=EA_Pub.SafeRequest(2,"cutarticle",1,"0|0",1)
	ViewNum=EA_Pub.SafeRequest(2,"viewnum",0,0,0)
	AddDate=EA_Pub.SafeRequest(2,"adddate",2,Now(),0)
	IsPass=EA_Pub.SafeRequest(2,"ispass",0,0,0)
	Source=EA_Pub.SafeRequest(2,"source",1,"",1)
	SourceUrl=EA_Pub.SafeRequest(2,"sourceurl",1,"",1)
	Summary=EA_Pub.SafeRequest(2,"summary",1,"",2)
	IsSaveAs=EA_Pub.SafeRequest(2,"saveas",0,0,0)
	Byter=Lenb(Text)
	If ImgPath="" Then ImgPath=EA_Pub.SafeRequest(2,"d_picture",1,"",1)
	CutArticle=Replace(CutArticle," ","")
	CutArticle=Replace(CutArticle,",","|")

	If PostId<>0 Then
		If InStr(1,","&Column_Power&",",","&ColumnId&"3,")<=0 Then 
			ErrMsg	= Replace(str_Comm_NotAccess,"$1",str_Comm_Edit_Operation)
			FoundErr= True
		End If

		If IsSaveAs=1 Then PostId=0
	Else
		If InStr(1,","&Column_Power&",",","&ColumnId&"1,")<=0 Then 
			ErrMsg	= Replace(str_Comm_NotAccess,"$1",str_Comm_Add_Operation)
			FoundErr= True
		End If
	End If
	If Len(Title)>150 Or Len(Title)=0 Then 
		ErrMsg="标题内容长度不符。"
		ErrMsg=ErrMsg&"<li>大于150或者等于0个字符"
		FoundErr=True
	End If
	If Len(Author)>16 Then 
		ErrMsg="作者长度不符。"
		ErrMsg=ErrMsg&"<li>大于16个字符"
		FoundErr=True
	ElseIf Len(Author)=0 then 
		Author="本站编辑"
	End If
	If Len(KeyWord)>20 Then 
		ErrMsg="关键字长度不符。"
		ErrMsg=ErrMsg&"<li>大于20个字符"
		FoundErr=True
	End If
	If Len(Summary)>250 Then 
		ErrMsg="文章简介长度不符。"
		ErrMsg=ErrMsg&"<li>大于250个字符"
		FoundErr=True
	End If
	
	If FoundErr Then Call EA_Manager.Error(1)
	
	If OutUrl="" Then 
		IsOut=0
	Else
		IsOut=1
	End If
	If ImgPath="" Then 
		IsImg=0
	Else
		IsImg=1
	End If
	
	TrueTime=Year(CDate(AddDate))
	TrueTime=TrueTime&Right("00"&Month(CDate(AddDate)),2)
	TrueTime=TrueTime&Right("00"&Day(CDate(AddDate)),2)
	TrueTime=TrueTime&Right("00"&Hour(CDate(AddDate)),2)
	TrueTime=TrueTime&Right("00"&Minute(CDate(AddDate)),2)
	TrueTime=TrueTime&Right("00"&Second(CDate(AddDate)),2)
	
	Randomize timer
	key="000000"&Cstr(Int((999999-1+100000)*Rnd+1))
	TrueTime=TrueTime&Right(Key,6)

	IsDis=EA_DBO.Get_Column_Info(ColumnId)(11,0)

	If Rs.State=1 Then rs.Close
	If PostId<>0 Then
		Sql="Select * From [NB_Content] Where [Id]="&PostId
		rs.Open Sql,Conn,2,2
	Else
		rs.Open "SELECT * FROM [NB_Content] WHERE 0=1",Conn,2,2
		rs.AddNew
	End If
		rs("title")=Title
		rs("author")=Author
		rs("authorid")=AuthorId
		rs("Content")=Text&" "
		rs("KeyWord")=KeyWord
		rs("ColumnId")=ColumnId
		rs("ColumnName")=ColumnName
		rs("ColumnCode")=ColumnCode
		rs("byte")=Byter
		rs("tcolor")=TColor
		rs("isimg")=IsImg
		rs("img")=ImgPath
		rs("istop")=IsTop
		rs("IsDis")=IsDis
		rs("outurl")=OutUrl
		rs("isout")=IsOut
		rs("CutArticle")=CutArticle
		rs("ViewNum")=ViewNum
		rs("AddDate")=AddDate
		rs("IsPass")=IsPass
		rs("Source")=Source
		rs("SourceUrl")=SourceUrl
		rs("Summary")=Summary
		rs("TrueTime")=TrueTime
		rs.update
	Rs.Close:Set Rs=Nothing

	If PostId=0 Then 
		If IsPass=0 Then 
			If iDataBaseType<>2 Then EA_DBO.Set_System_ManagerTopicTotal 1

			EA_DBO.Set_Column_ManagerTopicTotal ColumnId,1
		Else
			If iDataBaseType<>2 Then EA_DBO.Set_System_TopicTotal 1

			EA_DBO.Set_Column_TopicTotal ColumnId,1
		End If
	End If

	Application.Lock 
	Application(sCacheName&"IsFlush")=1
	Application.UnLock 
	
	Call EA_Pub.Close_Obj
	Set EA_Pub=Nothing
	
	Response.Redirect "admin_content.asp"
End Sub

Sub Batch()
	Dim Opertion,Id,ColumnId
	Dim TempArray,i,j,Temp
	
	FoundErr=False
	Id=Request.Form ("id")
	Opertion=Request.Form ("opertion")
	Id=Replace(Id," ","")
	TempArray=Split(Id,",")
	j=0
	
	Select Case Opertion
	Case "nodel"
		For i=0 To UBound(TempArray)
			EA_M_DBO.Set_Article_Resume TempArray(i)
		Next
	Case "pass"
		For i=0 To UBound(TempArray)
			Temp=EA_DBO.Get_Article_Info(TempArray(i),0)
			If IsArray(Temp) Then 
				If InStr(1,","&Column_Power&",",","&Temp(0,0)&"2,")>0 Then 
					EA_M_DBO.Set_Article_PassState 1,TempArray(i)
				Else
					j=j+1
					FoundErr=True
				End If
			End If
		Next
		ErrMsg = Replace(str_BatchOperationMessageForError,"$1",j)
	Case "nopass"
		For i=0 To UBound(TempArray)
			Temp=EA_DBO.Get_Article_Info(TempArray(i),0)
			If IsArray(Temp) Then 
				If InStr(1,","&Column_Power&",",","&Temp(0,0)&"2,")>0 Then 
					EA_M_DBO.Set_Article_PassState 0,TempArray(i)
				Else
					j=j+1
					FoundErr=True
				End If
			End If
		Next
		ErrMsg = Replace(str_BatchOperationMessageForError,"$1",j)
	Case "move"
		Dim ColumnCode,ColumnName
		ColumnId=Request.Form ("column")
		
		If IsNumeric(ColumnId) And ColumnId<>"" And ColumnId<>"0" Then
			Temp=EA_DBO.Get_Column_Info(ColumnId)
			If IsArray(Temp) Then
				ColumnCode=Temp(1,0)
				ColumnName=Temp(0,0)
				
				SQL="UpDate [NB_Content] Set ColumnId="&ColumnId&",ColumnCode='"&ColumnCode&"',ColumnName='"&ColumnName&"' Where [Id] In ("&Id&")"
				'Response.Write sql
				Conn.Execute(SQL)
			Else
				FoundErr = True
				ErrMsg	 = str_PassDataError
			End If
		Else
			FoundErr = True
			ErrMsg	 = str_PassDataError
		End If
	Case "make"
		Response.Write "<table width=""550"" border=""0"" cellpadding=""0"" cellspacing=""0"" align=""center"">"
		Response.Write "<form method=""post"" action=""admin_makeview.asp?atcion=mark"" name=""makeform"">"
		Response.Write "<tr valign=""middle"" align=""center"" height=""22"">"
		Response.Write "<td>"
		Response.Write "<input type=hidden name=sid value="""&Id&""">"
		Response.Write "<input type=hidden name=tag value=""4"">"
		Response.Write "</td>"
		Response.Write "</tr>"
		Response.Write "</form>"
		Response.Write "</table>"
		Response.Write "<script language=""JavaScript"">makeform.submit()</script>"

		Response.End
	End Select
	
	If FoundErr Then
		Call EA_Manager.Error(1)
	Else
		ErrMsg=str_BatchOperationMessageForSucess
		Call EA_Manager.Error(0)
	End If
End Sub

Sub Del
	Call EA_Pub.Chk_Post
	
	Dim PostId
	Dim ColumnId,AuthroId,IsPass,ReviewTotal,PostTime,TrueTime
	Dim sHTMLFilePath
	Dim Temp
	Dim objFSO
	
	PostId=EA_Pub.SafeRequest(3,"postid",0,0,0)
	
	If PostId<>0 Then
		Temp=EA_DBO.Get_Article_Info(PostId,0)
		If IsArray(Temp) Then
			ColumnId=Temp(0,0)
			AuthroId=Temp(7,0)
			PostTime=Temp(13,0)
			IsPass=Temp(20,0)
			TrueTime = Temp(25,0)
		End If
		
		If InStr(1,","&Column_Power&",",","&ColumnId&"4,")<=0 Then 
			ErrMsg = Replace(str_Comm_NotAccess,"$1",str_Comm_Del_Operation)
			Call EA_Manager.Error(1)
		End If

		If iDataBaseType<>2 Then
			'更新会员发表统计
			EA_DBO.Set_Member_PostTotal -1,AuthroId
		
			'删除评论及更新系统统计
			SQL="Select Count(Id) From [NB_Review] Where ArticleId="&PostId
			ReviewTotal=Conn.Execute(SQL)(0)
			SQL="Delete From [NB_Review] Where ArticleId="&PostId
			Conn.Execute(SQL)

			'更新系统信息
			EA_DBO.Set_System_ReviewTotal ReviewTotal-(ReviewTotal*2)
			If IsPass Then 
				EA_DBO.Set_System_TopicTotal -1
				EA_DBO.Set_Column_TopicTotal ColumnId,-1
			Else
				EA_DBO.Set_System_ManagerTopicTotal -1
				EA_DBO.Set_Column_ManagerTopicTotal ColumnId,-1
			End If
		End If
		
		EA_DBO.Set_Article_Del PostId
		
		On Error Resume Next
		'Delete HTML File
		sHTMLFilePath=EA_Pub.Cov_ArticlePath(PostId,PostTime,TrueTime,"0")
		If EA_Pub.Chk_IsExistsHtmlFile(sHTMLFilePath) Then 
			Set objFSO = CreateObject("Scripting.FileSystemObject")
			objFSO.DeleteFile server.MapPath (sHTMLFilePath)
		End If
		
		Application.Lock 
		Application(sCacheName&"IsFlush")=1
		Application.UnLock 
	End If
	
	Call EA_Pub.Close_Obj
	Set EA_Pub=Nothing
	
	Response.Redirect Request.ServerVariables("HTTP_REFERER")
End Sub
%>
